package cn.edu.ncu.housinghub.entity.appointment;

import cn.edu.ncu.housinghub.entity.house.House;
import cn.edu.ncu.housinghub.entity.user.Agent;
import cn.edu.ncu.housinghub.entity.user.Landlord;
import cn.edu.ncu.housinghub.entity.user.User;
import jakarta.validation.constraints.AssertTrue;
import lombok.Data;
import java.time.LocalDateTime;

import jakarta.validation.constraints.NotNull;

/**
 * 看房预约表，朱宏伟进行相关修改
 */
@Data
public class Appointment {
    private Long appointmentId; // 主键

    private Long tenantId;
    private Long houseId;
    private Long landlordId;
    private Long agentId;

//    @NotNull(message = "租客信息不能为空")
//    private User tenant; // 租客ID
//
//    @NotNull(message = "房源信息不能为空")
//    private House house; // 房源ID

    // 预约只能向中介或房东预约，但不能同时为空
//    @AssertTrue(message = "预约只能向中介或房东预约")
//    public boolean isLandlordOrAgent() {
//        return landlord != null || agent != null;
//    }

//    private Landlord landlord; // 房东ID
//    private Agent agent; // 中介ID

    @NotNull(message = "预约时间不能为空")
    private LocalDateTime appointmentTime; // 预约时间

    private Boolean isRefused; // 是否拒绝
    private String refusedReason; // 拒绝原因
    private String remarkMessage; // 备注信息

    // 关联查询字段
    private String tenantName; // 租客姓名
    private String tenantPhone; // 租客电话
    private String houseTitle; // 房源标题
    private String houseSummary; // 房源摘要
    private String houseLocation; // 房源位置
}
